<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>业绩管理</title>
    <meta name="description" content="业绩管理">
    <meta name="keywords" content="业绩管理">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="${contextPath}/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${contextPath}/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="${contextPath}/assets/css/app.css">
    <script src="${contextPath}/assets/js/jquery.min.js"></script>
    <style>
        .am-u-sm-4{height:35px;}
        .widget-body{margin-top: -20px}
    </style>
</head>

<body data-type="widgets">
    <script src="${contextPath}/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 头部 -->
        <#include "/pc/common/header.html">
        <!-- 侧边导航栏 -->
        <#include "/pc/common/left.html">
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <ol class="am-breadcrumb widget-head">
                                <li><a href="${contextPath}/index.htm" class="am-icon-home">首页</a></li>
                                <li>业绩管理</li>
                                <li>业绩结算</li>
                                <div class="am-btn-group-xs am-btn-group" style="float: right">
                                    <button type="button" class="am-btn am-btn-secondary" onclick="search_b()"><span class="am-icon-search"></span>搜索
                                    </button>
                                    <a href="${contextPath}/ach/list.htm"
                                       class="am-btn am-btn-warning">
                                        <span class="am-icon-refresh"></span>清空
                                    </a>
                                    <button type="button" class="am-btn am-btn-primary" onclick="close_b()"><span class="am-icon-cny"></span>结算
                                    </button>
                                    <a href="javascript:;" onclick="report()"
                                       class="am-btn am-btn-success">
                                        <span class="am-icon-file-excel-o"></span>导出
                                    </a>
                                </div>
                            </ol>
                            <div class="widget-body  am-fr">
                                <div class="am-u-sm-12">
                                    <div class="am-g">
                                        <#if Session.manager_js == 2>
                                        <div class="am-u-sm-4 am-form-inline">
                                            <label for="cityid" class="am-form-label">归属城市：</label>
                                            <div class="am-form-group">
                                                <select id="cityid" class="am-form-field" style="width: 185px;color: #a4a4a4;"
                                                        name="cityid">
                                                    <#if vo.cityid??>
                                                        <#assign cityid="${vo.cityid?c}" />
                                                    </#if>
                                                    ${dict.getCityOptions(cityid)}
                                                </select>
                                            </div>
                                        </div>
                                        </#if>
                                        <div class="am-u-sm-4 am-form-inline am-u-end">
                                            <label for="achtime" class="am-form-label">业绩时间：</label>
                                            <div class="am-form-group">
                                                <input type="text" class="am-form-field" id="achtime" name="achtime" data-am-datepicker="{format: 'yyyy-mm', viewMode: 'months', minViewMode: 'months'}"
                                                       placeholder="选择业绩时间" value="${vo.achtime!''}">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="am-u-sm-12" style="border-top: 1px solid #eef1f5;padding-top: 10px;margin-top: 10px">
                                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black am-text-nowrap am-scrollable-horizontal am-table-centered" id="example-r">
                                        <thead>
                                            <tr>
                                                <th>归属城市</th>
                                                <th>订单金额</th>
                                                <th>支付金额</th>
                                                <th>抽成比例</th>
                                                <th>业绩金额</th>
                                                <th>业绩时间</th>
                                                <th>结算状态</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <#list page as l>
                                            <tr class="gradeX">
                                                <td><#if l.cityid??>${dict.getCityName(l.cityid?c)}</#if></td>
                                                <td>${l.orderamount!0}<small>元</small></td>
                                                <td>${l.payamount!0}<small>元</small></td>
                                                <td>
                                                <#if l.agencyprop??>
                                                    %${l.agencyprop}
                                                </#if>
                                                </td>
                                                <td>${l.amount!0}<small>元</small></td>
                                                <td>
                                                    ${l.achtime!}
                                                </td>
                                                <td>
                                                    <#if l.status??>
                                                        ${dict.getDicName('ach_record_status',l.status?c)}
                                                    </#if>
                                                </td>
                                            </tr>
                                        </#list>
                                        </tbody>
                                    </table>
                                </div>
                                <#include "/pc/common/page.html">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <#include "/pc/common/alert.html" />
    <script src="${contextPath}/assets/js/amazeui.min.js"></script>
    <script src="${contextPath}/assets/js/amazeui.datatables.min.js"></script>
    <script src="${contextPath}/assets/js/dataTables.responsive.min.js"></script>
    <script src="${contextPath}/assets/js/amazeui.page.js"></script>
    <script src="${contextPath}/assets/js/app.js"></script>
    <script>
        function search_b(){
            var achtime = $("#achtime").val();
            var cityid = $("#cityid").val();
            var url = "${contextPath}/ach/list.htm?achtime="+achtime;
            if (cityid){
                url +="&cityid="+cityid;
            }
            location.href = url;
        }
        function report(){
            var achtime = $("#achtime").val();
            location.href ="${contextPath}/ach/report.htm?achtime="+achtime;
        }
        var close_b = function(){
            var achtime = $("#achtime").val();
            Mconfirm("你确定要结算 "+achtime+" 业绩吗？",function(){
                $.ajax({
                    url:"${contextPath}/ach/close.htm?achtime="+achtime,
                    type:"get",
                    dataType:"json",
                    success:function(data){
                        var json = $.parseJSON(data);
                        Malert(json.errMessage,function(){
                            location.reload();
                        });
                    }
                });
            })
        };
    </script>
</body>

</html>